using System;
using System.Collections.Generic;
using System.Text;
using System.Speech.Synthesis;
using System.Xml.Serialization;

namespace WozLib.UI.Ink.SketchCommands
{
  public class SpeekSketchCommand : SketchCommand
  {
    
    [XmlAttribute("TextToSpeak")]
    public string TextToSpeak
    {
      get { return _TextToSpeak; }
      set { _TextToSpeak = value; }
    } private string _TextToSpeak;


    public SpeekSketchCommand()
    {
    }

    public SpeekSketchCommand(string textToSpeak)
      : base()
    {
      TextToSpeak = textToSpeak;
    }

    public override void Redo()
    {
      if (TextToSpeak != null && TextToSpeak.Length > 0)
      {
        SpeechSynthesizer speechSynthesizer = new SpeechSynthesizer();
        speechSynthesizer.Speak(TextToSpeak);
      }
    }

    public override void Undo()
    {
      // can't undo speech
    }
  }
}
